-- ==== BEGIN LICENSE BLOCK ====
-- storyboard-addon - Copyright (C) Arnaud Charnoz, 2006-2010.
-- Distributed under the terms of the GNU Lesser General Public License (LGPL) as
-- published by the Free Software Foundation.
-- ===== END LICENSE BLOCK ====
 
Target = {};
 
Target.__index = Target;
 
-------------------------------------------------------------------------------

function Target:new()
    
    local self = {};
    setmetatable(self, Target);
     
    self.names = {};
     
    return self;
end

-------------------------------------------------------------------------------

--[ Method to set key to location object ]-- 
function Target:setKey( newKey )
     self.key = newKey;
end

-------------------------------------------------------------------------------

--[ Method to get key from location object ]--
function Target:getKey()
     return self.key;
end

-------------------------------------------------------------------------------

function Target:setNames( newNames )
     self.names = newNames;
end

-------------------------------------------------------------------------------
 
function Target:getNames()
     return self.names;
end

-------------------------------------------------------------------------------

function Target:addName( name )

    table.insert( self.names, name );
    
end

-------------------------------------------------------------------------------
 
function Target:hasName( name )
    
    for k,v in ipairs( self.names ) do
        if ( v == name )
        then
            return true;
        end
    end
  
    return false;
end

-------------------------------------------------------------------------------

function Target:exportToTable()
    
    local dataTable = {} ;
    
    table.insert( dataTable , self.key );
    table.insert( dataTable, self.names );

    return dataTable;
    
end

-------------------------------------------------------------------------------

function Target:importFromTable( dataTable )
    
    self.key = dataTable[1];
    self.names = dataTable[2];
   
end

-------------------------------------------------------------------------------